import { ref, computed } from "vue";
export const useOrderHooks = (ruleForm) => {
  const orderStepList = ref([
    {
      title: "买家下单",
    },
    {
      title: "确认订单",
    },
    {
      title: "双方签约",
    },
    {
      title: "商家发货",
    },
    {
      title: "买家收货",
    },
    {
      title: "交易成功",
    },
  ]);
  // 订单状态
  const getStatusValues = computed(() => {
    const order = ruleForm.value.buyerOrderList;
    const item = {
      label: "-",
      details: "-",
      steps: -1,
    };
    if (order) {
      switch (order.status) {
        case 0:
          item.label = "订单已取消";
          item.details = "订单已取消,如需要请重新下单！";
          break;
        case 1:
          item.label = "买家已下单，待卖家确认订单";
          item.details =
            "买家已下单，等待卖家确认订单，如卖家长时间未确认订单，请及时联系卖家积极处理，友好协商。";
          break;
        case 2:
          item.label = "买家已确认订单，待您再次确认";
          item.details = "买家已确认订单，等待您确认订单。";
          break;
        case 3:
          item.label = "您已确认订单，待平台确认订单";
          item.details =
            "买卖双方已确认订单，等待平台确认订单，如平台长时间未确认订单，请及时联系我们。";
          break;
        case 4:
          item.label = "买卖双方已确认订单，待双方签约";
          item.details =
            "买卖双方已确认订单，请您尽快到您的邮箱完成合同签署，如有任何问题请及时联系我们。";
          break;
        case 5:
          item.label = "买卖双方已签约，待卖家发货";
          item.details =
            "买卖双方已签约，等待卖家发货，如卖家长时间未发货，请及时联系卖家积极处理，友好协商。";
          break;
        case 6:
        case 7:
        case 8:
        case 9:
          item.label = "卖家已发货，待收货";
          item.details =
            "卖家已发货，等待收货，如长时间未收到货，请及时联系卖家积极处理，友好协商。";
          break;
        case 10:
          item.label = "交易完成";
          item.details =
            "货物已全部签收，感谢你对汽车出口商城的支持，欢迎再次使用。";
          break;
      }
      switch (order.status) {
        case 0:
          item.steps = -1;
          break;
        case 1:
          item.steps = 1;
        case 2:
          item.steps = 1;
          break;
        case 3:
          item.steps = 1;
          break;
        case 4:
          item.steps = 2;
          break;
        case 5:
          item.steps = 3;
          break;
        case 6:
        case 7:
          item.steps = 4;
          break;
        case 8:
        case 9:
          item.steps = 5;
          break;
        case 10:
          item.steps = 6;
          break;
      }
    }
    //   { value: 1, label: "待供应商确认" }, 1
    // { value: 2, label: "待平台审核" },1
    // { value: 3, label: "待签约" },2
    // { value: 4, label: "待发货" },3
    // { value: 5, label: "货运中" },4
    // { value: 6, label: "已到港" },4
    // { value: 7, label: "提车申请" }, 5
    // { value: 8, label: "提车通过" },5 // 提车通过
    // { value: 9, label: "已完成" },6 // 已提车
    // { value: 0, label: "已取消" }
    return item;
  });
  return {
    orderStepList,
    getStatusValues,
  };
};
